<template>
  <div v-loading="loading" class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('合伙企业投资信息') }}</span>
    </div>
    <el-form ref="queryForm" :model="hhqyPage" :inline="true">
      <el-form-item :label="$t('合伙企业名称')" prop="hhqyName">
        <el-input
          v-model="hhqyPage.hhqyName"
          :placeholder="$t('合伙企业名称')"
          clearable
          @keyup.enter.native="queryHandle"
        />
      </el-form-item>
      <el-form-item :label="$t('项目名称')" prop="dealName">
        <el-input
          v-model="hhqyPage.dealName"
          :placeholder="$t('项目名称')"
          clearable
          @keyup.enter.native="queryHandle"
        />
      </el-form-item>
      <el-form-item :label="$t('项目类型')" prop="dealType">
        <dict-select
          v-model="hhqyPage.dealType"
          dictionary="deal_type"
          :placeholder="$t('项目类型')"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t("重置") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="hhqyList" border>
      <el-table-column :label="$t('序号')" fixed type="index" align="center" show-overflow-tooltip width="50">
        <template slot-scope="scope">
          {{ (hhqyPage.pageNum - 1) * hhqyPage.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('合伙企业名称')" prop="hhqyName" align="center" show-overflow-tooltip />
      <el-table-column :label="$t('项目名称')" prop="dealName" align="center" show-overflow-tooltip />
      <el-table-column :label="$t('标的公司名称')" prop="companyName" align="center" show-overflow-tooltip />
      <el-table-column :label="$t('项目类型')" prop="dealType" align="center" :formatter="dealTypeFormat" show-overflow-tooltip width="110" />
      <el-table-column :label="$t('投资金额') + $t('金额单位')" prop="investAmount" align="center" show-overflow-tooltip width="110">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.investAmount, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('项目负责人')" prop="personChargeName" align="center" show-overflow-tooltip width="110" />
      <el-table-column :label="$t('项目阶段')" prop="dealStage" align="center" show-overflow-tooltip width="110" />
      <el-table-column :label="$t('基金管理人')" prop="gpName" align="center" show-overflow-tooltip width="110" />
    </el-table>
    <pagination
      v-show="hhqyTotal>0"
      :total="hhqyTotal"
      :page.sync="hhqyPage.pageNum"
      :limit.sync="hhqyPage.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { findHhqyInvestInfo } from '@/api/hhqy/base/hhqyBase'
export default {
  data() {
    return {
      hhqyList: [],
      // 遮罩层
      loading: false,
      // 合伙企业查询参数
      hhqyPage: {
        hhqyName: undefined,
        dealName: undefined,
        dealType: undefined,
        pageNum: 1,
        pageSize: 10
      },
      hhqyTotal: 0,
      // 项目类型字典
      dealTypeOptions: []
    }
  },
  created() {
    this.getList()
    this.getDicts('deal_type').then(response => {
      this.dealTypeOptions = response.data
    })
  },
  methods: {
    getList() {
      this.loading = true
      findHhqyInvestInfo(this.hhqyPage).then(response => {
        this.hhqyList = response.rows
        this.hhqyTotal = response.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    queryHandle() {
      this.hhqyPage.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.queryHandle()
    },
    // 是否分给配LP 系统是否字典翻译
    dealTypeFormat(row) {
      return this.selectDictLabel(this.dealTypeOptions, row.dealType)
    }
  }
}
</script>

<style scoped>

</style>
